<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>角色列表 - 权限管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css">
</head>
<body>
<div class="header">
    <div class="nav">
        <div class="nav-brand">权限管理系统</div>
        <ul class="nav-links">
            <li><a href="${pageContext.request.contextPath}/">首页</a></li>
            <li><a href="${pageContext.request.contextPath}/user/list">用户管理</a></li>
            <li><a href="${pageContext.request.contextPath}/role/list">角色管理</a></li>
            <li><a href="${pageContext.request.contextPath}/user/search">用户搜索</a></li>
        </ul>
    </div>
</div>

<div class="container">
    <div class="card">
        <h2>角色列表</h2>

        <table class="table">
            <thead>
            <tr>
                <th>ID</th>
                <th>角色名称</th>
                <th>描述</th>
                <th>状态</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="role" items="${roles}">
                <tr>
                    <td>${role.id}</td>
                    <td>${role.name}</td>
                    <td>${role.description}</td>
                    <td>
                                <span class="badge ${role.status == 0 ? 'badge-success' : 'badge-danger'}">
                                        ${role.status == 0 ? '正常' : '禁用'}
                                </span>
                    </td>
                    <td>${role.createTime}</td>
                    <td>
                        <a href="${pageContext.request.contextPath}/role/detail?roleId=${role.id}"
                           class="btn btn-primary">查看详情</a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
</div>
</body>
</html>